import { TextArea } from "../../../../fl/controls/TextArea";
import { ResizableUIScrollBar } from "./ResizableUIScrollBar";
import { ScrollEvent } from "../../../../fl/events/ScrollEvent";
import { ScrollBarDirection } from "../../../../fl/controls/ScrollBarDirection";
//class ScrollBarResizableTextArea
    
    export  class ScrollBarResizableTextArea extends TextArea
    {
       

        protected /* override */ configUI(): void
        {
            isLivePreview = checkLivePreview();
            var loc1=rotation;
            rotation = 0;
            var loc2=super.width;
            var loc3=super.height;
            var loc4;
            super.scaleY = loc4 = 1;
            super.scaleX = loc4;
            setSize(loc2, loc3);
            move(super.x, super.y);
            rotation = loc1;
            startWidth = loc2;
            startHeight = loc3;
            if (numChildren > 0) 
            {
                removeChildAt(0);
            }
            tabChildren = true;
            textField = new Object /* flash.text.TextField */();
            addChild(textField);
            updateTextFieldType();
            _verticalScrollBar = new ResizableUIScrollBar();
            _verticalScrollBar.name = "V";
            _verticalScrollBar.visible = false;
            _verticalScrollBar.focusEnabled = false;
            copyStylesToChild(_verticalScrollBar, ScrollBarResizableTextArea.SCROLL_BAR_STYLES);
            _verticalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
            addChild(_verticalScrollBar);
            _horizontalScrollBar = new ResizableUIScrollBar();
            _horizontalScrollBar.name = "H";
            _horizontalScrollBar.visible = false;
            _horizontalScrollBar.focusEnabled = false;
            _horizontalScrollBar.direction = ScrollBarDirection.HORIZONTAL;
            copyStylesToChild(_horizontalScrollBar, ScrollBarResizableTextArea.SCROLL_BAR_STYLES);
            _horizontalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
            addChild(_horizontalScrollBar);
            textField.addEventListener(flash.events.TextEvent.TEXT_INPUT, handleTextInput, false, 0, true);
            textField.addEventListener(flash.events.Event.CHANGE, handleChange, false, 0, true);
            textField.addEventListener(flash.events.KeyboardEvent.KEY_DOWN, handleKeyDown, false, 0, true);
            _horizontalScrollBar.scrollTarget = textField;
            _verticalScrollBar.scrollTarget = textField;
            addEventListener(flash.events.MouseEvent.MOUSE_WHEEL, handleWheel, false, 0, true);
            return;
        }

        public setScrollBarSize(arg1: number): void
        {
            horizontalScrollBar.setSize(arg1, height);
            verticalScrollBar.setSize(arg1, height);
            draw();
            return;
        }

        protected /* override */ drawLayout(): void
        {
            super.drawLayout();
            return;
        }

        protected /* override */ focusOutHandler(arg1: Object /* flash.events.FocusEvent */): void
        {
            var loc1=focusManager;
            if (loc1) 
            {
                loc1.defaultButtonEnabled = true;
            }
            super.focusOutHandler(arg1);
            if (editable) 
            {
                setIMEMode(false);
            }
            return;
        }

        protected static /* const */SCROLL_BAR_STYLES: Object={"downArrowDisabledSkin":"downArrowDisabledSkin", "downArrowDownSkin":"downArrowUpSkin", "downArrowOverSkin":"downArrowOverSkin", "downArrowUpSkin":"downArrowUpSkin", "upArrowDisabledSkin":"upArrowDisabledSkin", "upArrowDownSkin":"upArrowDownSkin", "upArrowOverSkin":"upArrowOverSkin", "upArrowUpSkin":"upArrowUpSkin", "thumbDisabledSkin":"thumbDisabledSkin", "thumbDownSkin":"thumbUpSkin", "thumbOverSkin":"thumbOverSkin", "thumbUpSkin":"thumbUpSkin", "thumbIcon":"thumbIcon", "trackDisabledSkin":"trackDisabledSkin", "trackDownSkin":"trackDownSkin", "trackOverSkin":"trackOverSkin", "trackUpSkin":"trackUpSkin", "repeatDelay":"repeatDelay", "repeatInterval":"repeatInterval"};
    }
